
from apps.common.base.serializers import *
from apps.interface.client.models import *

class ClientBaseSerializer(BaseSerializer):

    class Meta:
        model = Client
        fields = "__all__"

class ClientModelSerializer(ClientBaseSerializer):

    lesseeModel = serializers.SerializerMethodField()

    def get_lesseeModel(self, obj):
        try:
            return {'id': obj.lessee.id, 'name': obj.lessee.name}
        except:
            return {}

    class Meta:
        model = Client
        fields = "__all__"